﻿<Window x:Class="Sample.NewStopOrderWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:EcngTradingXaml="clr-namespace:StockSharp.Xaml;assembly=StockSharp.Xaml"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" Title="NewStopOrderWindow" Height="492" Width="262">
	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="100" />
			<ColumnDefinition Width="140" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

		<!--<Label Grid.Column="0" Grid.Row="0" Content="Счет:" />
		<EcngTradingXaml:PortfolioComboBox x:Name="Portfolio" Grid.Column="1" Grid.Row="0" />-->
        
        <Label Content="Счет:" Grid.Row="0" />
        <ComboBox Grid.Column="2" Grid.Row="0" Height="25" HorizontalAlignment="Left" Name="x_Portfolio" VerticalAlignment="Top" Width="137" SelectedIndex="0" />

		<ComboBox x:Name="x_StopOrderType" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" HorizontalContentAlignment="Right" SelectionChanged="StopOrderTypeSelectionChanged" >
			<ComboBoxItem x:Name="x_LinkedOrderType" Content="Связ. заявка" IsSelected="True"></ComboBoxItem>
			<ComboBoxItem Content="Стоп-лимит"></ComboBoxItem>
			<ComboBoxItem x:Name="OtherSecurityType" Content="По др. иструменту"></ComboBoxItem>
			<ComboBoxItem Content="Тейк-профит"></ComboBoxItem>
			<ComboBoxItem Content="Тэйк-профит и стоп-лимит"></ComboBoxItem>
		</ComboBox>
		
		<Label Grid.Column="0" Grid.Row="2" Content="Срок:" HorizontalAlignment="Right" />
		<xctk:DateTimePicker x:Name="x_ExpirationDate" Grid.Column="1" Grid.Row="2" />

        <Label Content="Инструмент:" Grid.Row="3" HorizontalAlignment="Right" ToolTip="Инструмент, которым управляет Робот" />
        <ComboBox Grid.Column="1" Grid.Row="3" Height="25" HorizontalAlignment="Left" Name="x_Security" VerticalAlignment="Top" Width="137"  SelectedIndex="0"/>


        <ComboBox x:Name="x_StopPriceCondition" Grid.Column="0" Grid.Row="4" HorizontalContentAlignment="Right">
			<ComboBoxItem Content="&lt;=" IsSelected="True" />
			<ComboBoxItem Content="&gt;=" />
		</ComboBox>
		<TextBox x:Name="x_StopPrice" Text="0" Grid.Column="1" Grid.Row="4" HorizontalContentAlignment="Right" />

		<Label Grid.Column="0" Grid.Row="5" Content="Цена:" HorizontalAlignment="Right" />
		<TextBox x:Name="x_Price" Text="0" Grid.Column="1" Grid.Row="5" TextAlignment="Right" />

		<Label Grid.Column="0" Grid.Row="6" Content="Объем:" HorizontalAlignment="Right" />
		<TextBox x:Name="x_Volume" Text="0" Grid.Column="1" Grid.Row="6" TextAlignment="Right" />

		<RadioButton x:Name="x_IsBuy" Content="Покупка" GroupName="Direction" IsChecked="True" Grid.Column="0" Grid.Row="7" />
		<RadioButton x:Name="x_IsSell" Content="Продажа" GroupName="Direction" Grid.Column="1" Grid.Row="7" />
		
		<Label Grid.Column="0" Grid.Row="8" Content="Отступ:" HorizontalAlignment="Right" />
		<EcngTradingXaml:UnitControl Grid.Column="1" Grid.Row="8" x:Name="x_Offset" />
		
		<Label Grid.Column="0" Grid.Row="9" Content="Спрэд:" HorizontalAlignment="Right" />
		<EcngTradingXaml:UnitControl Grid.Column="1" Grid.Row="9" x:Name="x_Spread" />
		
		<Label Grid.Column="0" Grid.Row="10" Content="Др. инструмент:" HorizontalAlignment="Right" />
		<ComboBox x:Name="x_OtherSecurities" DisplayMemberPath="Name" Grid.Column="1" Grid.Row="10" />
		
		<Label Grid.Column="0" Grid.Row="11" Content="Цена св. заявки:" HorizontalAlignment="Right" />
		<TextBox x:Name="x_LinkedOrderPrice" Text="0" Grid.Column="1" Grid.Row="11" HorizontalContentAlignment="Right" />
		
		<Label Grid.Column="0" Grid.Row="12" Content="Снять стоп:" HorizontalAlignment="Right" />
		<CheckBox x:Name="x_LinkedOrderCancel" Grid.Column="1" Grid.Row="12" HorizontalContentAlignment="Right" VerticalAlignment="Center" />
		
		<Label Grid.Column="0" Grid.Row="13" Content="Время действия:" HorizontalAlignment="Right" />
		<CheckBox x:Name="x_IsActiveTime" Grid.Column="1" Grid.Row="13" HorizontalContentAlignment="Right" VerticalAlignment="Center" Checked="IsActiveTimeChecked" />
		
		<xctk:TimePicker x:Name="x_ActiveTimeFrom" Grid.Column="0" IsEnabled="False" Grid.Row="14" />
		<xctk:TimePicker x:Name="x_ActiveTimeTo" Grid.Column="1" IsEnabled="False" Grid.Row="14" />
		
		<Label Grid.Column="0" Grid.Row="15" Content="Частич. исполн.:" HorizontalAlignment="Right" />
		<CheckBox x:Name="x_PartiallyMatched" Grid.Column="1" Grid.Row="15" HorizontalContentAlignment="Right" VerticalAlignment="Center" IsChecked="{x:Null}" IsEnabled="False" />
		
		<Label Grid.Column="0" Grid.Row="16" Content="Исполн. объем:" HorizontalAlignment="Right" />
		<CheckBox x:Name="x_UseMatchedBalance" Grid.Column="1" Grid.Row="16" HorizontalContentAlignment="Right" VerticalAlignment="Center" IsChecked="{x:Null}" IsEnabled="False" />
		
		<Label Grid.Column="0" Grid.Row="17" Content="Лимит Цена:" HorizontalAlignment="Right" />
		<TextBox x:Name="x_StopLimitPrice" Text="0" Grid.Column="1" Grid.Row="17" TextAlignment="Right" IsEnabled="False" />

		<Button x:Name="Send" Content="Отправить" IsDefault="True" Grid.Column="0" Grid.Row="18" Grid.ColumnSpan="2" Width="100" Height="22" Click="SendClick" />
	</Grid>
</Window>
